public class SwapNoTemp {
    public static void main(String[] args) {
        //不使用三方变量
        //两次异或回原值
           int a = 10,b = 20;
        a = a ^ b;//temp = a ^ b;
        b = a ^ b;//b = temp ^ b;(实际上 b = a)
        a = a ^ b;//a = temp ^ b(实际上a = b = a ^ b ^ a)

        System.out.println("a=" + a);
        System.out.println("b=" + b);

    }

}
